package com.somewater.game
{
	import com.nbooo.ui.BaseMenu;
	import com.pblabs.engine.PBE;
	import com.pblabs.rendering2D.SceneAlignment;
	import com.pblabs.rendering2D.ui.SceneView;
	import com.somewater.control.IClear;
	import com.somewater.controller.PopUpManager;
	import com.somewater.storage.Lib;
	
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class GameMenu extends Sprite implements IClear
	{
		
		public static var worldScene:SceneView;
		
		private var ground:DisplayObject;
		
		public function GameMenu()
		{
			super();
			
			ground = Lib.getMc("BalanceGround");
			addChild(ground);
			
			if(stage)
				initPBE();
			else
				addEventListener(Event.ADDED_TO_STAGE, initPBE);
		}
		
		
		public function clear():void
		{
			
		}
		
		private function initPBE(e:Event = null):void
		{
			if(e) removeEventListener(Event.ADDED_TO_STAGE, initPBE);
			
			PBE.startup(this);
			PBE.IS_SHIPPING_BUILD = CONFIG::debug;
			
			worldScene = new SceneView();
			worldScene.width = PopUpManager.instance.WIDTH;
			worldScene.height = PopUpManager.instance.HEIGHT;
			
			PBE.initializeScene(worldScene, "SceneDB");
			PBE.scene.sceneAlignment = SceneAlignment.TOP_LEFT;
			
			
		}
	}
	
	
}